﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using WpfApplication5.Models;
using WpfApplication5.ViewModels;

namespace WpfApplication5
{
    public class MasterDetailTemplateSelector:DataTemplateSelector
    {
        public DataTemplate FunctionInfoTemplate { get; set; }
        public DataTemplate FunctionCategoryTemplate { get; set; }

        public override DataTemplate SelectTemplate(object item, DependencyObject container)
        {
            FunctionInfoViewModel info = item as FunctionInfoViewModel;
            if (info != null)
            {
                return FunctionInfoTemplate;
            }

            FunctionCategoryViewModel cate = item as FunctionCategoryViewModel;
            if (cate != null)
            {
                return FunctionCategoryTemplate;
            }
            return base.SelectTemplate(item, container);
        }
    }
}
